/*
 * Copyright (C) 2012 Michael Widmer <widmm8@bfh.ch>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package ch.bfh.aeneas.navigation;

import android.os.Parcel;
import android.os.Parcelable;

/**
 *
 * @author Michael Widmer <widmm8@bfh.ch>
 */
public class RouteInfo implements Parcelable {
    
    public static final Parcelable.Creator<RouteInfo> CREATOR
        = new Parcelable.Creator<RouteInfo>() {
        public RouteInfo createFromParcel(Parcel in) {
            return new RouteInfo(in);
        }

        public RouteInfo[] newArray(int size) {
            return new RouteInfo[size];
        }
    };
     
    protected RouteInfo(Parcel in) {
        
        mName = in.readString();
        mDistanceStart = in.readFloat();
        mDistanceTarget = in.readFloat();
        mLength = in.readFloat();
    }
    
    private String mName;
    private float mDistanceStart;
    private float mDistanceTarget;
    private float mLength;
    
    public RouteInfo(String name) {
        mName = name;
        mDistanceStart = 0.0f;
        mDistanceTarget = 0.0f;
        mLength = 0.0f;
    }
    
    public String getName() {
        return mName;
    }
    
    public void setDistanceToStart(float distance) {
        mDistanceStart = distance;
    }
    
    public float getDistanceToStart() {
        return mDistanceStart;
    }
    
    public void setDistanceToTarget(float distance) {
        mDistanceTarget = distance;
    }
    
    public float getDistanceToTarget() {
        return mDistanceTarget;
    }
    
    public void setLength(float length) {
        mLength = length;
    }
    
    public float getLength() {
        return mLength;
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel arg0, int arg1) {
        arg0.writeString(mName);
        arg0.writeFloat(mDistanceStart);
        arg0.writeFloat(mDistanceTarget);
        arg0.writeFloat(mLength);
    }
}
